#include "timer.h"

#include <QDebug>
#include <QTimer>

Timer::Timer( QObject* parent )
    : QObject( parent ),
      m_timer( new QTimer( this ) )
{
    connect( m_timer, SIGNAL( timeout() ), this, SIGNAL( out() ) );
    //connect( m_timer, SIGNAL(  ), this, SIGNAL( out() ) );

}

void Timer::setInterval( int msec )
{
    if ( m_timer->interval() == msec )
        return;
    m_timer->stop();
    m_timer->setInterval( msec );
    m_timer->start();
    emit intervalChanged(); //signal
    qDebug() << Q_FUNC_INFO << "interval =" << m_timer->interval();
}
void Timer::setE( int b )
{
    if(b)
        m_timer->start();
    else
        m_timer->stop();
    qDebug() << QString(b);
     emit eChanged();
}
int Timer::e()
{
    return m_timer->isActive();
}
int Timer::interval()
{
    return m_timer->interval();
}
void Timer::aa(int a)
{
    qDebug() << "asdsad";

}
